package example.demo.bean;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Date;

@Data
public class User {
    @NotNull
    private String username;
    @NotEmpty
    private String password;
    /**
     * 只有传递给email的不为null，@Email对应的才会校验 EmailValidator
     */
    @Email
    @NotNull
    private String email;
    @NotNull
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date birthday;
    @NotNull
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime localDateTime;
}
